CD Script for the VM - Updated README and vm.md for the new deploy script #130
+376
−366
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #125
One command on the VM updates the site to
main:./scripts/deploy.sh.What it does
/opt/project2/backend, runs the migrations and restarts the systemd serviceproject2-backend. If a migration fails or the backend does not start, it puts the previous code back./var/www/html/project2, and deletes files inassets/older than 14 days.docs/vm.mdis rewritten around the script, from 430 to about 250 lines.npm run buildvmis removed.Different from the issue: no shared group. A service user
project2runs the backend from/opt/project2, and the script usessudofor the copy and the restart. Everyone deploys from their own checkout.How it was tested
In a Docker container with Ubuntu 26.04, systemd, PostgreSQL and Apache 2.4.66, set up with "First-time setup" in
docs/vm.mdand the Test dataset:Not tested: the Full dataset, the real
sudopassword prompt, and a reboot of the VM.npm run checkpasses.After merge: the one-time setup on the VM (service user,
.env, stop thenohupbackend) and the first deploy, done together.Use of AI
Claude Code wrote the script, the service file and the new
docs/vm.md, and ran the tests in the container. The tests found three faults that were then fixed: the first deploy failed on an empty database, an update of the script did not take effect in the same run, and a crashing backend stayed down. I read the script and the docs and decided the design (own checkout, service user, no shared group).